package pdd;

import java.util.Arrays;
import java.util.Scanner;

/**
 * Created by JiaJia on 2019/7/27 0027.
 */
public class SignCandy {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int m=scanner.nextInt();
        int[] child=new int[m];
        for (int i = 0; i <m ; i++) {
            child[i]=scanner.nextInt();
        }
        int n=scanner.nextInt();
        int[] candy=new int[n];
        for (int i = 0; i <n; i++) {
            candy[i]=scanner.nextInt();
        }
        System.out.println(maxChild(child,candy));
    }
    private static int maxChild(int[] child,int[] candy){
        Arrays.sort(child);
        Arrays.sort(candy);
        int result=0;
        int chi=0,cai=0;
        while (chi<child.length&&cai<candy.length){
            if (child[chi]<=candy[cai]){
                chi++;
            }
            cai++;
        }
        return chi;
    }
}
